package me.edzh.spring.bootstrap.utils;

import java.util.ArrayList;
import java.util.List;

public class ListUtils {
    public static <T, E> List<E> newList(List<T> fromList, Processor<T,E> processor ) {
        List<E> result = new ArrayList<>(fromList.size());
        for (T t : fromList) {
            result.add(processor.process(t));
        }

        return result;
    }

    public interface Processor<T,E> {
        E process(T input);
    }
}
